﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manageweb_LeftFrame : System.Web.UI.Page
{
    MODEL.Master MM = new MODEL.Master();
    MODEL.Master _MM = new MODEL.Master();

    BLL.Master BM = new BLL.Master();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["MasterID"] == null)
        {
            Response.Redirect("Default.aspx");
        }

        CheckAuthority();

        LeftControlInit();
    }


    protected void CheckAuthority()
    {
      bool  IsAllow = Convert.ToInt32(Session["UserRole"]) == 2 ? true : false;
      if (!IsAllow)
        {
            this.TreeView1.Nodes.RemoveAt(0);
            this.TV_StockMember.Nodes[4].ChildNodes.RemoveAt(1);

        }

    }


    #region LeftControlInit
    protected void LeftControlInit()
    {
        MM.Master_ID = Convert.ToInt32(Session["MasterID"]);

        _MM = BM.GetDataByID(MM);

        if (_MM.Master_Role > 1)
        {
            LeftAdvanced1.Visible = false;
            LeftNews1.Visible = false;
            LeftINews1.Visible = false;
        }
        else
        {
            LeftAdvanced1.Visible = true;
            LeftNews1.Visible = true;
            LeftINews1.Visible = true;
        }
    }
    #endregion

}
